package cn.glutnn.subject.common.enums;


import lombok.Getter;

@Getter
public enum CategoryTypeEnum {
    PRIMARY(1, "一级分类"),
    SECONDARY(2, "二级分类");

    private Integer code;
    private String desc;

    CategoryTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static CategoryTypeEnum getByCode(int codeValue) {
        for (CategoryTypeEnum categoryTypeEnum : CategoryTypeEnum.values()) {
            if (categoryTypeEnum.getCode().equals(codeValue)) {
                return categoryTypeEnum;
            }
        }
        return null;
    }
}
